from syslogd.configuration.Configuration import Configuration
import os


class Utils(object):
    
    @staticmethod
    def iif(test, true, false):
        if test:
            return true
        else:
            return false
        
    @staticmethod  
    def makeFifo():
        if os.path.exists(Configuration.getFifoPath()):
            os.remove(Configuration.getFifoPath())
        os.mkfifo(Configuration.getFifoPath())
        return open(Configuration.getFifoPath(), 'r')
        #return os.open(Configuration.getFifoPath(), os.O_RDONLY|os.O_NONBLOCK)